(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.attribute.viewController', viewController);
	viewController.$inject = [ '$scope', 'Constants', 'modalService', 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'attributeService' ];
	function viewController($scope, Constants, modalService, layoutConfig, validatorConfig, gridService, authService, attributeService) {
		var ctrl = this, attributeInfo = $scope.$stateParams.params;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.attribute = attributeInfo;
		
		ctrl.init = function() {
			ctrl.innerGridOptions = gridService.createInnerGridOptions($scope, ctrl.layoutConfig.formConfigs.paramValues.tableConfigs.table);
			ctrl.innerGridOptions.data = 'vm.attribute.dynaparm.parmValues';
			attributeService.initAttributeOption(ctrl, $scope);
			return authService.view(attributeInfo).then(function(response) {
				ctrl.attribute = response.data || attributeInfo;
			}, angular.noop);
		};
	}
})(angular);